home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectShow_WinXP / VMR / VMRPlayer / app.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-08  |  7.7 KB  |  444 lines

  1. //------------------------------------------------------------------------------
  2. // File: app.h
  3. //
  4. // Desc: DirectShow sample code
  5. //       - Main header file for VMRPlayer sample
  6. //
  7. // Copyright (c) 1994 - 2001, Microsoft Corporation.  All rights reserved.
  8. //------------------------------------------------------------------------------
  9.  
  10. /* -------------------------------------------------------------------------
  11. ** Function prototypes
  12. ** -------------------------------------------------------------------------
  13. */
  14. int
  15. DoMainLoop(
  16.     void
  17.     );
  18.  
  19. BOOL
  20. InitApplication(
  21.     HINSTANCE hInstance
  22.     );
  23.  
  24. BOOL
  25. InitInstance(
  26.     HINSTANCE hInstance,
  27.     int nCmdShow
  28.     );
  29.  
  30. BOOL
  31. LoadWindowPos(
  32.     LPRECT lprc
  33.     );
  34.  
  35. BOOL
  36. SaveWindowPos(
  37.     HWND hwnd
  38.     );
  39.  
  40. void
  41. PatB(
  42.     HDC hdc,
  43.     int x,
  44.     int y,
  45.     int dx,
  46.     int dy,
  47.     DWORD rgb
  48.     );
  49.  
  50. void
  51. UpdateMpegMovieRect(
  52.     void
  53.     );
  54.  
  55. void
  56. GetAdjustedClientRect(
  57.     RECT *prc
  58.     );
  59.  
  60. BOOL
  61. DrawStats(
  62.     HDC hdc
  63.     );
  64.  
  65. void
  66. CalcMovieRect(
  67.     LPRECT lprc
  68.     );
  69.  
  70. LPCTSTR
  71. IdStr(
  72.     int idResource
  73.     );
  74.  
  75. void
  76. UpdateSystemColors(
  77.     void
  78.     );
  79.  
  80. void
  81. SetDurationLength(
  82.     REFTIME rt
  83.     );
  84.  
  85. void
  86. SetCurrentPosition(
  87.     REFTIME rt
  88.     );
  89.  
  90. TCHAR *
  91. FormatRefTime(
  92.     TCHAR *sz,
  93.     REFTIME rt
  94.     );
  95.  
  96. void
  97. DoMpegVideoPropertyPage();
  98.  
  99. void
  100. DoMpegAudioPropertyPage();
  101.  
  102. /* -------------------------------------------------------------------------
  103. ** Registry routines
  104. ** -------------------------------------------------------------------------
  105. */
  106. int
  107. ProfileIntIn(
  108.    const TCHAR *szKey,
  109.    int iDefault
  110.    );
  111.  
  112. BOOL
  113. ProfileIntOut(
  114.    const TCHAR *szKey,
  115.    int iDefault
  116.    );
  117.  
  118. void
  119. ProfileStringOut (
  120.     LPTSTR  szKey,
  121.     LPTSTR  sz
  122.     );
  123.  
  124. UINT
  125. ProfileStringIn (
  126.     LPTSTR  szKey,
  127.     LPTSTR  szDef,
  128.     LPTSTR  sz,
  129.     DWORD   cb
  130.     );
  131.  
  132. BOOL
  133. LoadWindowPos(
  134.     LPRECT lprc
  135.     );
  136.  
  137. BOOL
  138. SaveWindowPos(
  139.     HWND hwnd
  140.     );
  141.  
  142. HKEY
  143. GetAppKey(
  144.     BOOL fCreate
  145.     );
  146.  
  147.  
  148. /* -------------------------------------------------------------------------
  149. ** Message crackers
  150. ** -------------------------------------------------------------------------
  151. */
  152. /* void Cls_OnUser(HWND hwnd, WPARAM wParam, LPARAM lParam ) */
  153. #define HANDLE_WM_USER(hwnd, wParam, lParam, fn) \
  154.     ((fn)(hwnd, wParam, lParam), 0L)
  155.  
  156. /* LRESULT Cls_OnNotify(HWND hwnd, int idFrom, NMHDR FAR* pnmhdr); */
  157. #ifndef HANDLE_WM_NOTIFY
  158. #define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \
  159.     (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam))
  160. #endif
  161.  
  162.  
  163.  
  164. /* -------------------------------------------------------------------------
  165. ** VideoCd window class prototypes
  166. ** -------------------------------------------------------------------------
  167. */
  168. extern "C" LRESULT CALLBACK
  169. VideoCdWndProc(
  170.     HWND hwnd,
  171.     UINT message,
  172.     WPARAM wParam,
  173.     LPARAM lParam
  174.     );
  175.  
  176. void
  177. VideoCd_OnClose(
  178.     HWND hwnd
  179.     );
  180.  
  181. BOOL
  182. VideoCd_OnQueryEndSession(
  183.     HWND hwnd
  184.     );
  185.  
  186. void
  187. VideoCd_OnDestroy(
  188.     HWND hwnd
  189.     );
  190.  
  191. void
  192. VideoCd_OnCommand(
  193.     HWND hwnd,
  194.     int id,
  195.     HWND hwndCtl,
  196.     UINT codeNotify
  197.     );
  198.  
  199. void
  200. VideoCd_OnPaint(
  201.     HWND hwnd
  202.     );
  203.  
  204. void
  205. VideoCd_OnTimer(
  206.     HWND hwnd,
  207.     UINT id
  208.     );
  209.  
  210. BOOL
  211. VideoCd_OnCreate(
  212.     HWND hwnd,
  213.     LPCREATESTRUCT lpCreateStruct
  214.     );
  215.  
  216. void
  217. VideoCd_OnSize(
  218.     HWND hwnd,
  219.     UINT state,
  220.     int cx,
  221.     int cy
  222.     );
  223.  
  224. void
  225. VideoCd_OnActivate(
  226.     HWND hwnd,
  227.     WPARAM wParam,
  228.     LPARAM lParam
  229.     );
  230.  
  231. void
  232. VideoCd_OnHScroll(
  233.     HWND hwnd,
  234.     HWND hwndCtl,
  235.     UINT code,
  236.     int pos
  237.     );
  238.  
  239. void
  240. VideoCd_OnUser(
  241.     HWND hwnd,
  242.     WPARAM wParam,
  243.     LPARAM lParam
  244.     );
  245.  
  246. void
  247. VideoCd_OnSysColorChange(
  248.     HWND hwnd
  249.     );
  250.  
  251. void
  252. VideoCd_OnMenuSelect(
  253.     HWND hwnd,
  254.     HMENU hmenu,
  255.     int item,
  256.     HMENU hmenuPopup,
  257.     UINT flags
  258.     );
  259.  
  260. void
  261. VideoCd_OnInitMenuPopup(
  262.     HWND hwnd,
  263.     HMENU hMenu,
  264.     UINT item,
  265.     BOOL fSystemMenu
  266.     );
  267.  
  268. #ifdef WM_NOTIFY
  269. LRESULT
  270. VideoCd_OnNotify(
  271.     HWND hwnd,
  272.     int idFrom,
  273.     NMHDR FAR* pnmhdr
  274.     );
  275. #endif
  276.  
  277.  
  278. void
  279. VideoCd_OnGraphNotify(
  280.     void
  281.     );
  282.  
  283. void
  284. VideoCd_OnDropFiles(
  285.     HWND hwnd,
  286.     HDROP hdrop);
  287.  
  288. void
  289. SetPlayButtonsEnableState(
  290.     void
  291.     );
  292.  
  293.  
  294.  
  295. /* -------------------------------------------------------------------------
  296. ** Command processing functions
  297. ** -------------------------------------------------------------------------
  298. */
  299.  
  300. BOOL
  301. VcdPlyerCaptureImage(
  302.     LPCSTR szFile
  303.     );
  304.  
  305. BOOL
  306. VcdPlyerDisplayCapturedImage(
  307.     LPCSTR szFile
  308.     );
  309.  
  310. BOOL
  311. VcdPlayerOpenCmd(
  312.     int i
  313.     );
  314.  
  315. BOOL
  316. VcdPlayerCloseCmd(
  317.     void
  318.     );
  319.  
  320. BOOL
  321. VcdPlayerPlayCmd(
  322.     void
  323.     );
  324.  
  325. BOOL
  326. VcdPlayerStopCmd(
  327.     void
  328.     );
  329.  
  330. BOOL
  331. VcdPlayerRewindCmd(
  332.     void
  333.     );
  334.  
  335. BOOL
  336. VcdPlayerPauseCmd(
  337.     void
  338.     );
  339.  
  340. BOOL
  341. VcdPlayerStepCmd(
  342.     void
  343.     );
  344.  
  345. void
  346. VcdPlayerSeekCmd(
  347.     REFTIME rtSeekBy
  348.     );
  349.  
  350. void
  351. ProcessOpen(
  352.     TCHAR *achFileName,
  353.     BOOL bPlay = FALSE
  354.     );
  355.  
  356. int
  357. VcdPlayerChangeTimeFormat(
  358.     int id
  359.     );
  360.  
  361. BOOL CALLBACK TransDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
  362. BOOL CALLBACK AppImgDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
  363. LRESULT CALLBACK AboutDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  364.  
  365.  
  366. /* -------------------------------------------------------------------------
  367. ** Recent filename stuff
  368. ** -------------------------------------------------------------------------
  369. */
  370. typedef TCHAR RECENTFILES[MAX_PATH];
  371. #define MAX_RECENT_FILES    10
  372. #define ID_RECENT_FILE_BASE 500
  373.  
  374. int
  375. GetRecentFiles(
  376.     int LastCount
  377.     );
  378.  
  379. int
  380. SetRecentFiles(
  381.     TCHAR *FileName,
  382.     int iCount
  383.     );
  384.  
  385. #define CAPTURED_IMAGE_NAME        TEXT("VMRImage.bmp\0")
  386.  
  387. /* -------------------------------------------------------------------------
  388. ** Global Variables
  389. ** -------------------------------------------------------------------------
  390. */
  391. extern int              cxMovie;
  392. extern int              cyMovie;
  393. extern HWND             hwndApp;
  394. extern HWND             g_hwndStatusbar;
  395.  
  396. extern int              cx;
  397. extern int              cy;
  398. extern int              xOffset;
  399. extern int              yOffset;
  400. extern TCHAR            g_achFileName[];
  401. extern OPENFILENAME     ofn;
  402. extern DWORD            g_State;
  403. extern int              nRecentFiles;
  404. extern int              g_TimeFormat;
  405. extern LONG             lMovieOrgX, lMovieOrgY;
  406. extern BOOL             g_bSecondFileLoaded;
  407. extern RECENTFILES      aRecentFiles[MAX_RECENT_FILES];
  408.  
  409. extern FLOAT            g_xPos, g_yPos, g_xSize, g_ySize, g_Alpha;
  410.  
  411. /* -------------------------------------------------------------------------
  412. ** Constants
  413. ** -------------------------------------------------------------------------
  414. */
  415. #define LEFT_MARGIN 0
  416.  
  417.  
  418. /* -------------------------------------------------------------------------
  419. ** Video CD Player states
  420. **
  421. **  These are bit flags
  422. ** -------------------------------------------------------------------------
  423. */
  424.  
  425. #define VCD_PLAYING          0x0001
  426. #define VCD_STOPPED          0x0002
  427. #define VCD_PAUSED           0x0004
  428. #define VCD_SKIP_F           0x0008
  429. #define VCD_SKIP_B           0x0010
  430. #define VCD_FF               0x0020
  431. #define VCD_RW               0x0040
  432. #define VCD_SEEKING          (VCD_FF | VCD_RW)
  433. #define VCD_LOADED           0x0080
  434. #define VCD_NO_CD            0x0100
  435. #define VCD_DATA_CD_LOADED   0x0200
  436. #define VCD_EDITING          0x0400
  437. #define VCD_PAUSED_AND_MOVED 0x0800
  438. #define VCD_PLAY_PENDING     0x1000
  439. #define VCD_WAS_PLAYING      0x2000
  440. #define VCD_IN_USE           0x4000
  441. #define VCD_STEPPING         0x8000
  442.  
  443. enum {PerformanceTimer = 32, StatusTimer = 33};
  444.